package drds.global_transaction.api.message_codec.request_and_response.transaction.global_transaction.global_transaction_lock_record_ids_check;

import java.nio.ByteBuffer;

import drds.global_transaction.api.message_codec.request_and_response.transaction.TransactionResponse;
import lombok.Getter;
import lombok.Setter;

public class GlobalTransactionLockRecordIdsCheckResponseMessage extends TransactionResponse
{
	private static final long serialVersionUID = 1L;
	@Setter
	@Getter
	private boolean lock = false;

	@Override
	public short getTypeCode()
	{
		return global_transaction_lock_record_ids_check_response_message;
	}

	@Override
	protected void doEncode()
	{
		super.doEncode();
		byteBuffer.putShort((short) (lock ? 1 : 0));
	}

	@Override
	public void decode(ByteBuffer byteBuffer)
	{
		super.decode(byteBuffer);
		this.lock = byteBuffer.getShort() == 1;
	}
}
